<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="/themes/admin/assets/css/layui.css">
    <script src="/themes/admin/assets/layui.js"></script>
    <script src="/themes/admin/assets/jquery-3.2.1.min.js"></script>
  </head>
  <body>
    <form class="layui-form" action="">
      <div class="layui-form-item">
        <label class="layui-form-label">邮箱账户</label>
        <div class="layui-input-inline">
          <input type="text" name="value" value="{$smtp.value}" required  lay-verify="required" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">邮箱账户</div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
          <input type="text" name="extend" value="{$smtp.extend}" required lay-verify="required"  autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">邮箱密码</div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">端口</label>
        <div class="layui-input-inline">
          <input type="text" name="intro" value="{$smtp.intro}" required lay-verify="required" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">常规端口为25或587，若不能成功发送请在邮箱官网查询</div>
      </div>    
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit lay-filter="saveSMTP">保存</button>
          <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>

    <script>
      layui.use("layer");
      layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(saveSMTP)', function(data){
          $.ajax({
            type:"post",
            data:data.field,
            url:"/admin/system/smtp",
            success:function(e){
              layer.msg(e.msg);
            }
          });
          return false;
        });
      });
    </script>
  </body>
</html>